#include <bits/stdc++.h>

using namespace std;

struct SegmentTree {
    int l, r;
    long long mmax, add;
    #define l(x) tree[x].l
    #define r(x) tree[x].r
    #define mmax(x) tree[x].mmax
    #define add(x) tree[x].add
} tree[100010*4];

int a[100010],b[100010], n, m;

void build(int p, int l, int r){
    l(p) = l, r(p) = r;
    if(l == r) {mmax(p) = a[l]; return;}
    int mid = (l+r)/2;
    build(p*2,l,mid);
    build(p*2+1,mid+1,r);
    mmax(p) = max(mmax(p*2),mmax(p*2+1));
}

void spread(int p){
    if(add(p)){
        mmax(p*2) += add(p);
        mmax(p*2+1) += add(p);
        add(p*2) += add(p);
        add(p*2 + 1) += add(p);
        add(p) = 0;
    }
}

void change(int p, int l, int r, int d){
    if(l <= l(p) && r >= r(p)){
        mmax(p) += d;
        add(p) += d;
        return ;
    }
    spread(p);
    int mid = (l(p) + r(p)) / 2;
    if(l <= mid) change(p*2,l,r,d);
    if(r > mid) change(p*2 + 1, l ,r ,d);
    mmax(p) = max(mmax(p*2),mmax(p*2 + 1));
}

long long ask(int p, int l, int r){
    if(l <= l(p) && r >= r(p)){
        return mmax(p);
    }
    spread(p);
    int mid = (l(p) + r(p)) / 2;
    long long val = 0;
    if(l <= mid) val = max(val, ask(p*2,l,r));
    if(r > mid) val = max(val, ask(p*2+1,l,r));
    return val;
}


int main(){
    cin >> n;
    for(int i = 0; i <= n; ++i){
        cin >> a[i];
    }
    for(int i = 1; i <= n; ++i){
        cin >> b[i];
        a[i] -= b[i];
        a[i] += a[i-1];
    }
    build(1,1,n);
    for(int i = 1; i <= n; ++i){
        int ans = a[0];
        change(1,i,n,b[i]);
        cout << max((long long)a[0],ask(1,1,n)) << " ";
        change(1,i,n,-b[i]);
    }
}